home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
fortran
/
fort_fmt.zip
/
FMT.DOC
< prev
next >
Wrap
Text File
|
1992-07-13
|
12KB
|
372 lines
FMT
Automatic FORTRAN FORMAT Statements
Version 1.70
(c) 1990
"One of many STATOOLS(tm)..."
by
Gerard E. Dallal
54 High Plain Road
Andover, MA 01810
NOTICE
Copyright 1990 by Gerard E. Dallal. FMT is shareware. If
you find FMT to be useful, a non-exclusive license fee of $7
should be sent to the author.
DISCLAIMER
STATOOLS are provided "as is" without warranty of any
kind. The entire risk as to the quality, performance, and
fitness for intended purpose is with you. You assume
responsibility for the selection of the program and for the
use of results obtained from that program.
PAGE 2
PROGRAM DESCRIPTION
FMT takes the drudgery out of writing FORTRAN FORMAT
statements. Simply use a word processor or text editor to
create an ASCII file that looks just like the output you'd
like your program to produce. FMT turns the model into a set
of FORMAT statements that can be pasted into your FORTRAN
program. For example, FMT turns
Monthly Report
Wages
Employee Name Salary + Fringe = Total
Last First
{ } { } ^^^^.^^ ^^^^.^^ ^^^^.^^
into
* 33X,'Monthly Report'/
* 38X,'Wages'/
* /
* 18X,'Employee Name',11X,'Salary + Fringe = Total'/
* 16X,'Last',8X,'First'/
* /
* 11X,A13,' ',A9,6X,F7.2,4X,F7.2,4X,F7.2/
OPERATION
The input to FMT is an ASCII file containing the output
that is to be transformed into FORTRAN FORMAT statements. The
file should look just the way it is to appear on screen. FMT
automatically adds a leading blank to each line.
The name of the input file must have the qualifier UNF
(for "UNFormatted"). The resulting FORMAT statements will be
written to a file with the same basename and the qualifier FMT
(for "ForMaTted"). For example, when DESIGN is given in
response to the FMT prompt
Enter basename for text to be formatted.
(unformatted .UNF, formatted .FMT)
>
(or at the DOS prompt, by typing 'FMT basename' without
FMT G.E. Dallal
PAGE 3
quotes) the statements in the text file DESIGN.UNF are
transformed into FORMAT statements in the file DESIGN.FMT.
If the basename is prefixed by a hyphen (e.g., -DESIGN),
no leading blank is added to each line.
If the basename is prefixed by a left parenthesis
(e.g., )DESIGN), a separate FORMAT statement is created for
each line in the UNF file. Each statment in the FMT file
begins with 'FORMAT(' and ends with ')'.
Numerical data
Digits are represented by carets. Floating point numbers
are distinguished by the presence of a decimal point in the
string.
^^^^ becomes I4
^^^^. becomes F5.0
^^^.^^^ becomes F7.3
Numerical fields cannot run into each other. FMT cannot
distinguish between 2I2 and I4.
Character data
The tilde (~) represents a CHARACTER*1 variable (A1). A
string of 'n' tildes becomes nA1 in the FMT file. The first
and last characters of character variables of length greater
than 1 are denoted by the left brace ({) and right brace (}),
respectively.
~~~~~~~~~~~~ becomes 12A1
{ } becomes A12
{ }~~~{ } becomes A5,3A1,A4
Lines beginning with a period (.)
Lines in the UNF file that have a period (.) in column 1
receive special treatment. They appear in the FMT file
unchanged, except for having the initial period dropped. That
is, columns 2 through 80 of these lines are printed in columns
1 to 79 of the FMT file. A line in the UNF file WITHOUT a
period in column 1 immediately preceding a line WITH a period
in column 1 ends with a left parenthesis rather than a slash
in the FMT file.
FMT G.E. Dallal
PAGE 4
This feature allows subroutines that contain many FORMAT
statements to be kept in UNF files for easy maintenance. For
example, when
. SUBROUTINE OUTPUT(IOUT)
. WRITE (IOUT, 10)
. 10 FORMAT (
This example illustrates FMT's handling of lines beginning
with a period. Entire programs and subroutines may be kept in
UNF format for easy maintenance.
. RETURN
. END
is processed by FMT, it becomes
SUBROUTINE OUTPUT(IOUT)
WRITE (IOUT, 10)
10 FORMAT (
* 9X,'This example illustrates FMT''s handling of lines beg',
* 'inning'/
* 9X,'with a period. Entire programs and subroutines may be ke',
* 'pt in'/
* 9X,'UNF format for easy maintenance.')
RETURN
END
NOTES
1. The qualifier UNF is not added to the basename in
response to the FMT prompt.
2. Blank lines in the UNF file become slashes (/) in the
FMT file.
3. The last line in the UNF file ends in a left
parenthesis in the FMT file.
4. Lines that end in $$ in the UNF file end in '$) in the
FMT file.
5. Carets (^), tildes (~), and braces ({,}) cannot be
used as text in the UNF file. If these characters are
needed, use a surrogate in the UNF file and use a text
editor to replace them after the FMT file has been
created.
FMT G.E. Dallal
PAGE 5
6. Unbalanced braces will cause the program to terminate
with an error message.
7. Single quotes may appear in the UNF file. They will
be doubled appropriately in the FMT file.
UPDATE HISTORY
1.01 -- Lines ending in Fw.0 no longer have ,'' before the
final slash. The extra characters did not
affect the behavior of the FORMAT statement;
they merely looked unsightly.
1.10 -- Internal enhancements not affecting output.
1.20 -- Long character strings with embedded commas now
split properly.
ASCII 250 and 255 (PC-Write's hard and soft
spaces) automatically translated to spaces.
1.30 -- Long formats now split prope